//
//  JCVerificationInfo.swift
//  JChat
//
//  Created by JIGUANG on 14/04/2017.
//  Copyright © 2017 HXHG. All rights reserved.
//

import UIKit


enum JCVerificationType: Int {
    case wait
    case accept
    case reject
    case receive
    case unkonw
}


class JCVerificationInfo: NSObject {
    var id = 0
    var username: String = ""
    var nickname: String = ""
    var appkey: String = ""
    var resaon: String = ""
    var state: Int = -1
    var timestamp: TimeInterval = 0
    var initiator: String = ""
    var type: MTRequestVerifyType = .all
    /// 审批事件 Id
    var eventId: String = ""
    /// 送礼数量
    var giftCount: Int = 0
    /// 省
    var province: String = ""
    /// 市
    var city: String = ""
    /// 区域
    var area: String = ""
    /// 俱乐部id
    var clubId: String = ""
    
    /// 是否被邀请入群
    var isInitiativeApply: Bool = false
    
//    static func create(username: String, nickname: String?, appkey: String, resaon: String?, state: Int, initiator: String) ->  JCVerificationInfo {
//        let info = JCVerificationInfo()
//        info.username = username
//        info.nickname = nickname ?? ""
//        info.appkey = appkey
//        info.resaon = resaon ?? ""
//        info.state = state
//        info.initiator = initiator
//        return info
//    }
    
    
    /// 构建申请信息
    /// - Parameters:
    ///   - username: 俱乐部id
    ///   - nickname: 俱乐部名称
    ///   - appkey: appkey description
    ///   - resaon: resaon description
    ///   - state: state description
    ///   - initiator: 申请俱乐部的 userName
    ///   - type: 申请类型 1 - 好友申请, 2 - 俱乐部申请
    ///   - eventId: 通过加入俱乐部申请的 事件id - 好友请求必填
    ///   - giftCount: 送礼数量
    ///   - province: 省
    ///   - state - 0 等待 1 - 同意 2 - 拒绝 3 - 等待对方同意 5 - 未知
    ///   - city: 市
    ///   - area: 区 / 县
    ///   - clubId: 申请加入的俱乐部id
    static func create(username: String, nickname: String?, appkey: String, resaon: String?, state: Int, initiator: String, type: MTRequestVerifyType = .all, eventId: String, giftCount: Int = 0, province: String = "", city: String = "", area: String = "", clubId: String = "", isInitiativeApply: Bool = false) ->  JCVerificationInfo {
        let info = JCVerificationInfo()
        info.username = username
        info.nickname = nickname ?? ""
        info.appkey = appkey
        info.resaon = resaon ?? ""
        info.state = state
        info.initiator = initiator
        info.type = type
        info.eventId = eventId
        info.giftCount = giftCount
        info.province = province
        info.city = city
        info.area = area
        info.clubId = clubId
        info.isInitiativeApply = isInitiativeApply
        return info
    }
}
